<?php
/**
 * @Author: kendy
 * @Date:   2019-12-18 15:46:26
 * @Last Modified by:   jiayanting
 * @Last Modified time: 2020-04-03 09:43:55
 */

namespace app\hotel\controller;

use app\hotel\model\OrderComplains as oc;
use Think\Db;
use think\Request;
use think\Session;

class OrderComplains extends Common
{
	/**
	 * [OrderComplainsList 商家投诉订单列表]
	 * @Author   kendy
	 * @DateTime 2019-12-18T15:52:43+0800
	 */
	  public function Ordercomplains()
	  { 
	  	 if (Request::instance()->isAjax()){  
            $data =  model('OrderComplains')->getHotelOrderComplainList();
            $count = model('OrderComplains')->getHotelOrderComplainList(true);
            return ['code'=>0,'msg'=>'','count'=>$count,'data'=>$data]; 
        }else{ 
            $res =  model('OrderComplains')->getHotelOrderComplainList(); 
            $this->assign('res', $res);
            return view(); 
        }
	  }
	  /**
	   * [solved 商家投诉结果]
	   * @Author   kendy
	   * @DateTime 2019-12-19T10:51:26+0800
	   * @return   [type]                   [description]
	   */
     public function solved()
     {
         if (Request::instance()->isAjax()) { 
            $res =  model('OrderComplains')->solved();
            if ($res) {
                return 1;
            } else {
                return 2;
            } 

        }  
     }

   /**
    * [getOrdercomplainsInfo 获取订单投诉详情]
    * @Author   kendy
    * @DateTime 2019-12-23T14:03:34+0800
    * @return   [type]                   [description]
    */
   public function getOrdercomplainsInfo()
   { 
      if (request()->isAjax()) {
            $postData = input('param.');
            $where = "order_id= {$postData['order_id']}"; 
            $hotelOrderInfo = model('OrderComplains')->getOrdercomplainsInfo($where);
            return ['code'=>0,'msg'=>'','count'=>1,'data'=>$hotelOrderInfo];  
        }
   }

 }